﻿
--获得单位异动人员
CREATE proc [dbo].[proc_Employee_CompanyMove_GetList_Count]
(
	@CompanyId int,
	@DepId int,
	@Stext nvarchar(50)
)
as

	Begin
	Declare @bmbh_T  varchar(30)
	Select @bmbh_T=bmbh From department Where id=@DepId
	
	Select Count(EC.Id) from Employee_CompanyMove  EC
	Where 
	(@CompanyId=0 Or EC.BCompanyId=@CompanyId)
	and (@DepId=0 Or  EC.BDepartmentId in(Select Id From department Where Left(bmbh,Len(@bmbh_T))=@bmbh_T))
	and (@Stext='' Or EC.Ename like '%'+@Stext+'%')
	End
	RETURN
